# Maintainer: Jonathan Steel <jsteel@aur.archlinux.org>
# Contributor: Justin Davis <jrcd83@gmail.com>

pkgname=perl-sub-exporter
pkgver=0.991
pkgrel=1
pkgdesc="A sophisticated exporter for custom-built routines"
arch=('any')
license=('PerlArtistic' 'GPL')
options=('!emptydirs')
depends=('perl' 'perl-data-optlist' 'perl-params-util' 'perl-sub-install')
url="https://metacpan.org/release/Sub-Exporter"
source=(https://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/Sub-Exporter-$pkgver.tar.gz)
sha512sums=('7829bbca1eb332156ba33dd0cbde7f57c178ad56cc03e76c1b7d5327c94ce15bb5172894eeef011e12e472071a7d7a07f514a1121535d96ae05ed0ef6734b329')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB="" \
      PERL_AUTOINSTALL="--skipdeps"            \
      PERL_MM_OPT="INSTALLDIRS=vendor"         \
      PERL_MB_OPT="--installdirs vendor"       \
      MODULEBUILDRC=/dev/null

    cd "$srcdir"/Sub-Exporter-$pkgver

    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""

    cd "$srcdir"/Sub-Exporter-$pkgver

    make test
  )
}

package() {
  cd "$srcdir"/Sub-Exporter-$pkgver

  make DESTDIR="$pkgdir"/ install
}
